package day2;

import java.util.Scanner;

import org.junit.Test;

public class java {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		System.out.println("请输入单价\r\n");
		double danjia = sc.nextDouble();
		System.out.println("请输入数量\r\n");
		double shuliang = sc.nextDouble();

		if (0 < danjia * shuliang && danjia * shuliang < 500) {
			System.out.println("应收金额为:\r\n" + danjia * shuliang);
			System.out.println("请输入金额\r\n");
			double jine = sc.nextDouble();
			System.out.println("找零" + (jine - danjia * shuliang));
		} else if (danjia * shuliang >= 500) {
			System.out.println("应收金额为:" + danjia * shuliang * 0.8);
			System.out.println("请输入金额\r\n2");
			double jine = sc.nextDouble();
			System.out.println("找零:" + (jine - danjia * shuliang * 0.8));
		} else {
			System.out.println("错误数据");
		}
	}

}
